////////////////////////////////////////////////////////////////////////////
// Name: weapons.h
// Author: B. Gian James <gian@BattleDroids.net>
// Description: The definitions and declaration for weapon systems
//
// $Id: weapons.h,v 1.2 2009/08/28 22:55:17 gian Exp $
////////////////////////////////////////////////////////////////////////////

#include "common.h"

typedef struct
{
	uint8	roll:4;	// 2
	uint8	die:4;	// d6

} WpnDamage;

typedef struct
{
	uint8	type:2;
	uint8 	recoil:2;
	uint8	error:2;
	uint8 	threat:2;

} WpnMod;

/////////////////////////////////////// Weapon
typedef struct
{
	uint8		id;
	WpnDamage	dmg;
	WpnMod		mods;
	uint8		mount;		// mount point from droid.h
	uint8		range;
	uint8		weight;
	uint8		cost;
	uint16		quality;

} DroidWeapon;

class Weapon
{
public:
	static void		SetWeaponRoll(uint8 n,DroidWeapon &dw) { dw.dmg.roll = n; } 
	static void		SetWeaponDie(uint8 n,DroidWeapon &dw) { dw.dmg.die = n; }
	static void		SetWeaponType(uint8 n,DroidWeapon &dw) { dw.mods.type = n; }
	static void		SetWeaponRecoil(uint8 n,DroidWeapon &dw) { dw.mods.recoil = n; }
	static void		SetWeaponError(uint8 n,DroidWeapon &dw) { dw.mods.error = n; }
	static void		SetWeaponThreat(uint8 n,DroidWeapon &dw) { dw.mods.threat = n; }
};

////////////////// Weapon Qualities
#define	WPN_ACCURATE	0x0001
#define WPN_DRAIN		0x0002
#define WPN_COMPOSITE	0x0004
#define WPN_DEPENDABLE	0x0008
#define WPN_GUIDED		0x0010
#define WPN_INACCURATE	0x0020
#define WPN_OVERHEAT	0x0040
#define WPN_STOVEPIPE	0x0080
#define WPN_SLOW_ATK	0x0100
#define WPN_SLOW_RELOAD	0x0200
#define WPN_UNRELIABLE	0x0400
#define WPN_UPGRADES	0x0800

/////////////////// Weapon Upgrades
#define WPN_FULLAUTO	0x0001
#define WPN_XTRA_RAIL	0x0002
#define WPN_SIGHT_LASER	0x0004
#define WPN_SIGHT_REDOT	0x0008
#define WPN_PRECISION	0x0010
#define WPN_DURABILITY	0x0020
#define WPN_SPEEDLOAD	0x0040
#define WPN_MORE_AMMO	0x0080

////////////////////////////////////// Ammo
#define AMMO_BASIC		1
#define AMMO_FMJ		2
#define AMMO_AP1		3
#define AMMO_AP2		4
#define AMMO_AP3		5
#define AMMO_AP4		6
#define AMMO_API		7
#define AMMO_HEI		8
#define AMMO_SMOKE		9
#define AMMO_FLARE		10
#define AMMO_EN_CELL	11
#define AMMO_EN_BLISTER	12
#define AMMO_EN_PULSE	13

///////////////////////////////////// Damage Locations
#define DMG_LOC_CARGO	1
#define DMG_LOC_CONTROLS 2
#define DMG_LOC_PWRSRC	3
#define DMG_LOC_FUEL	4
#define DMG_LOC_WEAPONS	5
#define DMG_LOC_TRACTION 6
#define DMG_LOC_CPU_CORE 7
#define DMG_LOC_CPU_TGT	8
#define DMG_LOC_CPU_COM	9
